/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import entidades.Enumeraciones.EstadoCivil;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Version;

/**
 *
 * @author Felipe
 */
@Entity
@Table (name = "TUTORES")
public class Tutor implements Serializable
{
    @Id
    @Column (name = "ID_TUTOR")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;
    
    @JoinColumn (name = "IDENTIFICACION")
    @OneToOne (cascade = CascadeType.ALL)
    private Identificacion identificacion;
    
    @Enumerated (EnumType.STRING)
    @Column (name = "ESTADO_CIVIL")
    private EstadoCivil estadoCivil;
    
    @Column (name = "VINCULO")
    private String vinculo;
    
    @ManyToOne (cascade = {CascadeType.PERSIST, CascadeType.MERGE})
    @JoinColumn (name = "DOMICILIO")
    private Domicilio domicilio;
    
    @OneToOne (cascade = CascadeType.ALL)
    @JoinColumn (name = "CONTACTO")
    private Contacto contacto;
    
    @OneToMany (mappedBy = "tutor")
    private List<DatosPersonales> datosPersonales;
    
    @Version
    private Timestamp version;
    
    public Tutor ()
    {
        
    }

    public long getId()
    {
        return id;
    }

    public void setId(long id)
    {
        this.id = id;
    }
    
    public EstadoCivil getEstadoCivil()
    {
        return estadoCivil;
    }

    public void setEstadoCivil(EstadoCivil estadoCivil)
    {
        this.estadoCivil = estadoCivil;
    }

    public String getVinculo()
    {
        return vinculo;
    }

    public void setVinculo(String vinculo)
    {
        this.vinculo = vinculo;
    }

    public Domicilio getDomicilio()
    {
        return domicilio;
    }

    public void setDomicilio(Domicilio domicilio)
    {
        this.domicilio = domicilio;
    }

    public Contacto getContacto()
    {
        return contacto;
    }

    public void setContacto(Contacto contacto)
    {
        this.contacto = contacto;
    }

    public List<DatosPersonales> getDatosPersonales()
    {
        return datosPersonales;
    }

    public void setDatosPersonales(List<DatosPersonales> datosPersonales)
    {
        this.datosPersonales = datosPersonales;
    }

    public Identificacion getIdentificacion()
    {
        return identificacion;
    }

    public void setIdentificacion(Identificacion identificacion)
    {
        this.identificacion = identificacion;
    }
}
